<template>

    <view>
        <cu-custom bgColor="bg-gradual-blue" :isBack="false">
            <block slot="content">代理表</block>
        </cu-custom>
        <product :productList="productList" :typeInfo="PageCur"></product>
        <view class="cu-bar tabbar bg-white shadow foot">
            <view class="action" @click="NavChange" data-cur="jwbc">
                <view class='cuIcon-cu-image'>
                    <text class="lg cuIcon-appreciate" :class="PageCur=='jwbc'?'text-red':'text-gray'"></text>
                </view>
                <view :class="PageCur=='jwbc'?'text-red':'text-gray'">京卫本草</view>
            </view>
            <view class="action" @click="NavChange" data-cur="axsq">
                <view class='cuIcon-cu-image'>
                    <text class="lg cuIcon-like" :class="PageCur=='axsq'?'text-red':'text-gray'"></text>
                </view>
                <view :class="PageCur=='axsq'?'text-red':'text-gray'">爱心神奇</view>
            </view>
            <view class="action" @click="NavChange" data-cur="xhyy">
                <view class='cuIcon-cu-image'>
                    <text class="lg cuIcon-add" :class="PageCur=='xhyy'?'text-red':'text-gray'"></text>
                </view>
                <view :class="PageCur=='xhyy'?'text-red':'text-gray'">协和医院</view>
            </view>
            <view class="action" @click="NavChange" data-cur="fbj">
                <view class='cuIcon-cu-image'>
                    <text class="lg cuIcon-evaluate" :class="PageCur=='fbj'?'text-red':'text-gray'"></text>
                </view>
                <view :class="PageCur=='fbj'?'text-red':'text-gray'">肤倍佳</view>
            </view>
            <view class="action" @click="NavChange" data-cur="ym">
                <view class='cuIcon-cu-image'>
                    <text class="lg cuIcon-we" :class="PageCur=='ym'?'text-red':'text-gray'"></text>
                </view>
                <view :class="PageCur=='ym'?'text-red':'text-gray'">医美</view>
            </view>
            <view class="action" @click="NavChange" data-cur="qt">
                <view class='cuIcon-cu-image'>
                    <text class="lg cuIcon-similar" :class="PageCur=='qt'?'text-red':'text-gray'"></text>
                </view>
                <view :class="PageCur=='qt'?'text-red':'text-gray'">其他</view>
            </view>
        </view>
    </view>
</template>

<script>
    import product from "../../colorui/components/product.vue";
    export default {
        components: {
            product,
        },
        data() {
            return {
                PageCur: 'jwbc',
                productList: [],
            }
        },
        methods: {
            NavChange: function (e) {
                this.PageCur = e.currentTarget.dataset.cur
                this.getData(this.PageCur)
            },
            getData: function (type) {
                uni.request({
                    url: 'http://47.100.177.119/music/wx/getproductlistbytype/' + type,
                    success: (res) => {
                        this.productList = res.data
                        this.productList.forEach(item=>{
                            item.enableEdit=false;
                        })
                    }
                });
            }
        },
        mounted() {
            this.getData('jwbc')
        },

    }
</script>

<style>

</style>
